﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Splittergame
{
    class SmokeSystem
    {
        private Texture2D smokeTexture;
        private SmokeParticle[] SmokeArray;
        private const int MAX_PARTICLES = 100;
        private Vector2 m_StartPosition;


        public SmokeSystem(Vector2 startPosition)
        {
            m_StartPosition = startPosition;
        }

        internal void LoadContent(ContentManager content)
        {
            //TODO: FLYTTA TEXTUR TILL VIEW

            smokeTexture = content.Load<Texture2D>("particlesmoke");
            SmokeArray = new SmokeParticle[MAX_PARTICLES];

            for (int i = 0; i < MAX_PARTICLES; i++)
            {
                SmokeArray[i] = new SmokeParticle(i, smokeTexture, m_StartPosition);
            }

        }
        public void Update(GameTime elapsedTime)
        {
            foreach (SmokeParticle Smoke in SmokeArray)
            {
                Smoke.Update(elapsedTime);
            }

        }
        internal void Draw(SpriteBatch spriteBatch, Camera camera)
        {
            foreach (SmokeParticle Smoke in SmokeArray)
            {
                Smoke.Draw(spriteBatch, camera);
            }
        }

    }
}
